﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using LuaInterface;

namespace LuaDemo
{
    public partial class Form1 : Form
    {
       
        public Form1()
        {
       
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
       

        }

        public void Sleep(int time)
        {
            Thread.Sleep(time);
        }

        public void Fun(int intTst, float floatTst,String strTst,bool boolTst)
        {
            if (intTst == 1)
            {
                if (floatTst > 10)
                {
                    Console.WriteLine(strTst);
                }
                else
                {
                    Console.WriteLine("HelloWord");
                }
            }
            else
            {
                Console.WriteLine("WordHello");
            }
          
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Lua lua = new Lua();

            lua.RegisterFunction("Sleep", this, this.GetType().GetMethod("Sleep"));
            lua.RegisterFunction("Fun", this, this.GetType().GetMethod("Fun"));
            String filePath = txtStriptName.Text;
            lua.DoFile(filePath);
        }



    }
}
